package com.gosling.gosling;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;

import java.time.LocalDate;
import java.time.Period;
import java.time.chrono.ChronoLocalDate;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class Test20240718 {

    public static void main(String[] args) throws Exception {

        String str = "123_settle_certificate.pdf";
        String _loan_certificate = "_loan_certificate.pdf";
        String _settle_certificate = "_settle_certificate.pdf";
        List<String> sufixList = ListUtil.of(_loan_certificate, _settle_certificate);

        //如何让string中包含list中的任意一个元素

        boolean contains = sufixList.stream().anyMatch(str::contains);
        System.out.println(contains);
//        System.out.println(str.contains(sufixList));

        System.out.println(DateUtil.parseLocalDateTime("2024-08-27 12:35:09").toLocalDate().toString());
        long until = LocalDate.of(2024, 10, 25).until(LocalDate.now(), ChronoUnit.DAYS);

        System.out.println(until);

    }

    private static void ruankao2() {
        String str = "e=2.718aT9\tRf\n#";
        String strln = "\n";
        int lc = 0, uc = 0, dc = 0, oc = 0;

        System.out.println(str.length());
        System.out.println(strln.length());
        char[] charArray = str.toCharArray();
        for (char c : charArray) {
            if (StrUtil.isLowerCase("" + c)) {
                //3
                lc++;
            } else if (StrUtil.isUpperCase("" + c)) {
                //2
                uc++;
            } else if (NumberUtil.isNumber("" + c)) {
                //5
                dc++;
            } else {
                //5
                oc++;
            }
        }
        System.out.printf("lc=%d uc=%d dc=%d oc=%d\n", lc, uc, dc, oc);
        //3,2,5,5
    }

    private static void ruankao1() {
        int m, n;
        for (m = 3; m > 0; --m) {
            for (n = 0; n < m; ++n) {
//                System.out.printf("%d %d\n", m, n);
                System.out.println(m + "," + n);
                break;
            }
        }
    }

    static void foo(int n) {
        System.out.printf("%d ", n);
        if (n > 1) {
            foo(n - 1);
        }
        System.out.printf("%d ", n);
    }

}
